<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class ShopUserAddresses extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
      //创建用户个人地址表
        Schema::create('shop_user_addresses', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('user_id');
            $table->string('getname', 20);
            $table->string('phone', 15);
            $table->string('address', 255);
            $table->unsignedTinyInteger('whether_address')->comment('1:是默认地址;2:不是默认地址');
            $table->timestamps();

            $table->foreign('user_id')
              ->references('id')->on('shop_home_users')
              ->onDelete('cascade');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shop_user_addresses');
    }
}
